<template>
  <el-dialog :title="title"
             :visible.sync="visible"
             v-loading="loading"
             :before-close="modalClose"
             :close-on-click-modal="false"
             :close-on-press-escape="false"
             width="50%">

    <el-card>
      <div class="div-box">
        <span>会员姓名：XXXX</span><span>会员性别：XXXX</span>
        <span>会员年龄：XXXX</span>
        <el-divider></el-divider>
        <span>会员病症：主病；并发症、并发症</span>
        <span>参与主题：XXXXXX</span>
        <el-divider></el-divider>
        <span>购药时间：2021.12:02</span>
        <span>购药金额：759.21元</span>
        <span>购药前检测项：XXX、XXX</span>
        <el-divider></el-divider>
      </div>

      <el-form ref="formRef"
               :model="formModel"
               label-width="100px">
        <el-form-item label="购药清单：">
          <el-table :data="tableData"
                    style="width: 100%"
                    border>
            <el-table-column prop="name"
                             label="药品名称">
            </el-table-column>
            <el-table-column prop="type"
                             label="类别">
            </el-table-column>
            <el-table-column prop="size"
                             label="规格">
            </el-table-column>
            <el-table-column prop="package"
                             label="包装">
            </el-table-column>
            <el-table-column prop="fachtory"
                             label="厂家/产地">
            </el-table-column>
            <el-table-column prop="num"
                             label="数量">
            </el-table-column>
          </el-table>
        </el-form-item>
        <el-form-item label="购药小票：">
          <el-image style="width: 100px; height: 100px"
                    :src="formModel.url"
                    :preview-src-list="srcList">
          </el-image>
        </el-form-item>
        <el-form-item label="审核时间："
                      v-if="dataObj.status === 2">
          2021.10.03 14:21:25
        </el-form-item>
        <el-form-item label="审核结果：">
          <el-radio-group v-model="formModel.result">
            <el-radio :label="0">不通过</el-radio>
            <el-radio :label="1">通过</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-input v-if="formModel.result === 0"
                  type="textarea"
                  v-model="formModel.reason"
                  placeholder="请输入不通过原因"></el-input>
      </el-form>
    </el-card>
    <p align="center"
       class="mt-20">
      <el-button type="info"
                 @click="modalClose">取 消</el-button>
      <el-button type="primary"
                 @click="submitForm">保 存</el-button>
    </p>
  </el-dialog>
</template>
<script>
  export default {
    name: 'detectionDialog', // 检测项赠送审核
    props: {
      dataObj: {
        type: Object,
        default: {}
      },
      visible: {
        type: Boolean,
        default: false
      },
    },
    data () {
      return {
        title: '',
        loading: false,
        formModel: {
          planName: '', // 方案名称
          url: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
          result: 0,
          reason: '',
          riskIds: ''
        },
        srcList: [
          'https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg',
          'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg'
        ],
        tableData: [
          { name: '药品名称' }
        ],

      }
    },
    methods: {
      modalClose () {
        this.$emit('update:visible', false); // 直接修改父组件的属性
      },
      submitForm () {
        this.$refs.formRef.validate((valid) => {
          if (valid) {

            console.log(this.formModel);
            // this.$parent.getList();
            // this.modalClose();
          }
        })
      },

    },
    created () {
      console.log(this.dataObj)
      if (this.dataObj) {

      }

    }
  }
</script>
<style scoped lang="scss">
  .div-box {
    span {
      padding-left: 20px;
    }
  }
</style>